import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs";
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/apartment"
const schoolIfnoUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/manager"
//信息api
const apiIndex = {
    //住宿数据导入
    ImportStayInfo: function (dataList, queryList, pageIndex, totalPages) {
        const data = {
            dataList, queryList, pageIndex, totalPages
        }
        return request({
            url: baseUrl + '/importData/importStayInfo',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //住宿信息导入前验证
    ImportStayInfoValidate: function (dataList, queryList, pageIndex, totalPages) {
        const data = {
            dataList, queryList, pageIndex, totalPages
        }
        return request({
            url: baseUrl + '/importData/importStayInfoValidate',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //列表
    AreaList: function () {
        const data = {

        }
        return request({
            url: schoolIfnoUrl + "/district/list",
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //提取信息
    BaseGet: function (id) {
        const data = {
            id
        }
        return request({
            url: baseUrl + '/viewBedsBase/get',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //列表
    List: function (page, search, fields) {
        const data = {
            page, search, fields
        }
        return request({
            url: baseUrl + "/viewBedsBase/list",
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //管理员操作学生退宿
    ConfirmCheckout: function (bedsIds, checkOutReason, handleTime, reserve, studentIds, fileName, fileUrl) {
        const data = {
            bedsIds, checkOutReason, handleTime, reserve, studentIds, fileName, fileUrl
        }
        return request({
            url: baseUrl + "/accommodationManage/batchConfirmCheckout",
            method: 'post',
            data: qs.stringify(data)
        })
    },

    //住宿轨迹
    AllocationList: function (search, order) {
        const data = {
            search,
            order
        }
        return request({
            url: baseUrl + "/allocationTrajectory/list",
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //住宿管理简易模式校区统计
    GetAreaDetails: function (areaId) {
        const data = {
            areaId
        }
        return request({
            url: baseUrl + '/accommodationManage/getAreaDetails',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //入住
    ConfirmCheckIn: function (bedsId, handleTime, studentId) {
        const data = {
            bedsId, handleTime, studentId
        }
        return request({
            url: baseUrl + '/accommodationManage/confirmCheckIn',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //调宿
    EmptyBedsLodge: function (bedsId, handleTime, studentId) {
        const data = {
            bedsId, handleTime, studentId
        }
        return request({
            url: baseUrl + '/accommodationManage/emptyBedsLodge',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //住宿管理简易模式校区统计
    GetBuildingDetails: function (buildingId) {
        const data = {
            buildingId
        }
        return request({
            url: baseUrl + '/accommodationManage/getBuildingDetails',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //住宿管理房态模式页面展示
    GetList: function (buildingId, collegeId, showEmpty) {
        const data = {
            buildingId, collegeId, showEmpty
        }
        return request({
            url: baseUrl + '/accommodationManage/getList',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //提取信息
    Get: function (id) {
        const data = {
            id
        }
        return request({
            url: baseUrl + '/manageClass/get',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //编辑
    Save: function (data) {
        const config = {
            headers: { 'Content-Type': 'application/json;charset=utf-8' },
        }
        return request.post(baseUrl + '/manageClass/save', data, config)
    },
    //删除
    Del: function (ids) {
        const data = {
            ids
        }
        return request({
            url: baseUrl + '/manageClass/delete',
            method: 'post',
            data: qs.stringify(data)
        })
    },

}
export { apiIndex }
